/*
  This file is part of 'Trivial chess'.

  'Trivial chess' is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  'Trivial chess' is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with 'Trivial chess'.  If not, see <http://www.gnu.org/licenses/>.
*/

/* SVN FILE: $Id$ */
/**
 * @author         $Author$
 * @version        $Rev$
 * @lastrevision   $Date$
 * @filesource     $URL$
 */

#ifndef SLIDERATTACKVEC_H_
#define SLIDERATTACKVEC_H_

#include <boost/cstdint.hpp>
#include <boost/array.hpp>

#include "SliderAffectVecAbstract.h"

template<class Br, class Sq, class Mn, class Vc, typename Int = int8_t>
class SliderAttackVec
	: public SliderAffectVecAbstract<SliderAttackVec<Br,Sq,Mn,Vc,Int>,Br,Sq,Mn,Vc,Int> {

public:
	SliderAttackVec<Br,Sq,Mn,Vc,Int>() : SliderAffectVecAbstract<SliderAttackVec<Br,Sq,Mn,Vc,Int>,Br,Sq,Mn,Vc,Int>() {}

	SliderAttackVec<Br,Sq,Mn,Vc,Int>(const Board& board, const Square sq, const Man mn)
		: SliderAffectVecAbstract<SliderAttackVec<Br,Sq,Mn,Vc,Int>,Br,Sq,Mn,Vc,Int>(board, sq, mn) {}

	bool isValid() const {
		if ( this->attack.isNil() )
			return false;

		const Man aMan = (*this->board)[this->attack];
		if ( aMan.isNil() )
			return true;

		return aMan.color() != this->man.color();
	}

};

#endif /* SLIDERATTACKVEC_H_ */
